<html>
<head><title>My Test Extension Options</title></head>
<script type="text/javascript">

// Saves options to localStorage.
function save_options() {
  var token = document.getElementById("token");
  var apiroot = document.getElementById("apiroot");
  
  localStorage["token"] = token.value;
  localStorage["apiroot"] = apiroot.value;

  // Update status to let user know options were saved.
  /*
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
  
  */
}

// Restores select box state to saved value from localStorage.
function restore_options() {
  var token = localStorage["token"];
  var apiroot = localStorage["apiroot"];
          
  if (token) {
    var tokenElement = document.getElementById("token");
    tokenElement.value = token;
  }

  if (apiroot) {
    var apirootElement = document.getElementById("apiroot");
    apirootElement.value = apiroot;
  }

}

</script>

<body onload="restore_options()">

Token:<input id="token" type="text" length="40"/><br>
API Root:<input id="apiroot" type="text"  length="40"/><br>
<button onclick="save_options()">Save</button>
</body>
</html>

